package com.huilian.iotbox.admin.dao;

import com.huilian.iotbox.data.po.Permission;
import com.huilian.iotbox.data.po.RolePermission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 少凡
 * @date 2020/2/29 10:36
 */
@Mapper
public interface RolePermissionDao {

    Integer authorize(@Param("roleId") Integer roleId, @Param("permissionId") Integer permissionId);

    Integer deleteByPermissionId(@Param("permissionId") Integer permissionId);

    List<RolePermission> findListByRoleId(Integer roleId);

    List<RolePermission> getByRoleIdAndPermissionId(List<Permission> permissionList, @Param("roleId") Integer roleId);

    List<Integer> findPermissionIdListByRoleId(@Param("roleId") Integer roleId,@Param("platformType") Integer platformType);

    void batchUpdate(@Param("list")List<Integer> list, @Param("roleId") Integer roleId, @Param("select") boolean select);

    void batchInsert(@Param("list") List<Integer> list, @Param("roleId") Integer roleId, @Param("select") boolean select);

    int updateSelectByPermissionId(@Param("permissionId") Integer permissionId, @Param("selected") boolean selected);
}
